home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_Tix.idb / usr / freeware / lib / tix4.1 / demos / MkManag.tcl.z / MkManag.tcl
Encoding:
Text File  |  1999-01-26  |  6.0 KB  |  172 lines

  1. # MkManag.tcl --
  2. #
  3. #    This file implements the "Manager" page in the widget demo
  4. #
  5. #    This file has not been properly documented. It is NOT intended
  6. #    to be used as an introductory demo program about Tix
  7. #    programming. For such demos, please see the files in the
  8. #    demos/samples directory or go to the "Samples" page in the
  9. #    "widget demo"
  10. #
  11. #
  12. # Copyright (c) 1996, Expert Interface Technologies
  13. #
  14. # See the file "license.terms" for information on usage and redistribution
  15. # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  16. #
  17.  
  18. proc MkManager {nb page} {
  19.     set w [$nb subwidget $page]
  20.  
  21.     set name [tixOptionName $w]
  22.     option add *$name*TixLabelFrame*label.padX 4
  23.  
  24.     tixLabelFrame $w.pane -label "tixPanedWindow"
  25.     tixLabelFrame $w.note -label "tixNoteBook"
  26.  
  27.     MkPanedWindow [$w.pane subwidget frame]
  28.     MkNoteBook    [$w.note subwidget frame]
  29.  
  30.     tixForm $w.pane -top 0 -left 0   -right $w.note -bottom -1
  31.     tixForm $w.note -top 0  -right -1 -bottom -1
  32. }
  33.  
  34. proc MkPanedWindow {w} {
  35.     set name [tixOptionName $w]
  36.  
  37.     message $w.msg -font -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*\
  38.     -relief flat -width 240 -anchor n\
  39.     -text {The PanedWindow widget allows the user to interactively\
  40. manipulate the\
  41. sizes of several panes. The panes can be arranged either vertically or\
  42. horizontally.}
  43.  
  44.     label $w.group -text "Newsgroup: comp.lang.tcl"
  45.  
  46.     tixPanedWindow $w.pane
  47.  
  48.     set p1 [$w.pane add list -min 70 -size 100]
  49.     set p2 [$w.pane add text -min 70]
  50.  
  51.     tixScrolledListBox $p1.list
  52.     $p1.list subwidget listbox config -font [tix option get fixed_font]
  53.  
  54.     tixScrolledText    $p2.text
  55.     $p2.text subwidget text    config -font [tix option get fixed_font]
  56.  
  57.     $p1.list subwidget listbox insert end \
  58.     "  12324 Re: TK is good for your health" \
  59.     "+ 12325 Re: TK is good for your health" \
  60.     "+ 12326 Re: Tix is even better for your health (Was: TK is good...)" \
  61.     "  12327 Re: Tix is even better for your health (Was: TK is good...)" \
  62.     "+ 12328 Re: Tix is even better for your health (Was: TK is good...)" \
  63.     "  12329 Re: Tix is even better for your health (Was: TK is good...)" \
  64.     "+ 12330 Re: Tix is even better for your health (Was: TK is good...)"
  65.  
  66.     $p2.text subwidget text config -wrap none -bg \
  67.     [$p1.list subwidget listbox cget -bg]
  68.     $p2.text subwidget text insert end {
  69. Mon, 19 Jun 1995 11:39:52        comp.lang.tcl              Thread   34 of  220
  70. Lines 353       A new way to put text and bitmaps together iNo responses
  71. ioi@xpi.com                  Ioi K. Lam at Expert Interface Technologies
  72.  
  73. Hi,
  74.  
  75. I have implemented a new image type called "compound". It allows you
  76. to glue together a bunch of bitmaps, images and text strings together
  77. to form a bigger image. Then you can use this image with widgets that
  78. support the -image option. This way you can display very fancy stuffs
  79. in your GUI. For example, you can display a text string string
  80. together with a bitmap, at the same time, inside a TK button widget. A
  81. screenshot of compound images can be found at the bottom of this page:
  82.  
  83.         http://www.xpi.com/tix/screenshot.html
  84.  
  85. You can also you is in other places such as putting fancy bitmap+text
  86. in menus, tabs of tixNoteBook widgets, etc. This feature will be
  87. included in the next release of Tix (4.0b1). Count on it to make jazzy
  88. interfaces!}
  89.  
  90.     pack $p1.list -expand yes -fill both -padx 4 -pady 6
  91.     pack $p2.text -expand yes -fill both -padx 4 -pady 6
  92.  
  93.     pack $w.msg   -side top -padx 3 -pady 3 -fill both
  94.     pack $w.group -side top -padx 3 -pady 3 -fill both
  95.     pack $w.pane  -side top -padx 3 -pady 3 -expand yes -fill both
  96. }
  97.  
  98. proc MkNoteBook  {w} {
  99.  
  100.     message $w.msg -font -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*\
  101.     -relief flat -width 240 -anchor n\
  102.     -text {The NoteBook widget allows you to lay out a complex\
  103. interface into individual pages.}
  104.  
  105.     # We use these options to set the sizes of the subwidgets inside the
  106.     # notebook, so that they are well-aligned on the screen.
  107.     #
  108.     set name [tixOptionName $w]
  109.     option add *$name*TixControl*entry.width 10
  110.     option add *$name*TixControl*label.width 18
  111.     option add *$name*TixControl*label.anchor e
  112.     option add *$name*TixNoteBook*tagPadX 8
  113.  
  114.  
  115.     tixNoteBook $w.nb -ipadx 6 -ipady 6
  116.  
  117.     # Create the two tabs on the notebook. The -underline option
  118.     # puts a underline on the first character of the labels of the tabs.
  119.     # Keyboard accelerators will be defined automatically according
  120.     # to the underlined character.    
  121.     #
  122.     $w.nb add hard_disk -label "Hard Disk" -underline 8
  123.     $w.nb add network   -label "Network"   -underline 0
  124.    
  125.     # Create the first page
  126.     #
  127.     set f [$w.nb subwidget hard_disk]
  128.  
  129.     # the frame for the buttons that are present in all the pages
  130.     #
  131.     frame $f.common
  132.     pack $f.common -side right -padx 2 -pady 2 -fill y
  133.     CreateCommonButtons $w $f.common
  134.  
  135.  
  136.     # Create the controls that only belong to this page
  137.     #
  138.     tixControl $f.a -value 12   -label "Access Time: "
  139.     tixControl $f.w -value 400  -label "Write Throughput: "
  140.     tixControl $f.r -value 400  -label "Read Throughput: "
  141.     tixControl $f.c -value 1021 -label "Capacity: "
  142.     pack $f.a $f.w $f.r $f.c  -side top -padx 20 -pady 2
  143.     
  144.     # Create the second page    
  145.     #
  146.     set f [$w.nb subwidget network]
  147.  
  148.     # the frame for the buttons that are present in all the pages
  149.     #
  150.     frame $f.common
  151.     pack $f.common -side right -padx 2 -pady 2 -fill y
  152.  
  153.     tixControl $f.a -value 12   -label "Access Time: "
  154.     tixControl $f.w -value 400  -label "Write Throughput: "
  155.     tixControl $f.r -value 400  -label "Read Throughput: "
  156.     tixControl $f.c -value 1021 -label "Capacity: "
  157.     tixControl $f.u -value 10   -label "Users: "
  158.     
  159.     CreateCommonButtons $w $f.common
  160.  
  161.     pack $f.a $f.w $f.r $f.c $f.u -side top -padx 20 -pady 2
  162.     pack $w.msg  -side top -padx 3 -pady 3 -fill both
  163.     pack $w.nb   -expand yes -fill both -padx 5 -pady 5 -side top
  164.  }
  165.  
  166. proc CreateCommonButtons {w f} {
  167.     button $f.ok     -text OK     -width 6
  168.     button $f.cancel -text Cancel -width 6
  169.  
  170.     pack $f.ok $f.cancel -side top -padx 2 -pady 2
  171. }
  172.